const Router = require('koa-router')
const {auth} = require('../middleware/auth.middleware')
const {getRoleList, addRole, updateRole, deleteRole} = require('../controller/roleController')
const {RoleValidator} = require('../middleware/role.middleware')

const roleRouter = new Router({prefix: '/role'})

roleRouter.get('/list', auth, getRoleList)

roleRouter.post('/add', auth, RoleValidator, addRole)

roleRouter.put('/update/:id', auth, RoleValidator, updateRole)

roleRouter.delete('/delete/:id', auth, deleteRole)

module.exports = roleRouter